﻿<UserControl x:Class="EtlViewer.Viewer.Controls.SequenceDiagram"
             x:ClassModifier="internal"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:local="clr-namespace:EtlViewer.Viewer.Controls"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300"  >
    <UserControl.Resources>
        <Style x:Key="TitleStyle" TargetType="{x:Type TextBlock}">
            <Style.Setters>
                <Setter Property="Foreground" Value="White"/>
                <Setter Property="FontWeight" Value="Bold"/>
            </Style.Setters>
        </Style>
        <DataTemplate x:Key="SequenceItemTemplate" DataType="x:Type Object">
            <local:SequenceObject Title="{Binding Path=Name}" />
        </DataTemplate>
        <ItemsPanelTemplate x:Key="SequenceObjectLayoutTemplate" >
            <StackPanel Orientation="Horizontal" />
        </ItemsPanelTemplate>
    </UserControl.Resources>
    <Grid DataContext="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:SequenceDiagram}}}">
        <Grid.RowDefinitions>
            <RowDefinition Height="25" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Border Background="#FF007ACC"  />
        <TextBlock Name="textBlockName" Text="{Binding Path=Title}" 
                   Style="{StaticResource TitleStyle}" 
                   VerticalAlignment="Center" 
                   HorizontalAlignment="Center" />
        <AdornerDecorator Grid.Column="0" Grid.Row="1" Margin="5">
            <ScrollViewer ScrollViewer.HorizontalScrollBarVisibility="Auto" 
                          ScrollViewer.VerticalScrollBarVisibility="Auto" >
                <ItemsControl ItemsSource="{Binding Path=SequenceObjects}" 
                          Name="SequenceItems"
                          ItemsPanel="{StaticResource SequenceObjectLayoutTemplate}" 
                          ItemTemplate="{StaticResource SequenceItemTemplate}"  
                          />
            </ScrollViewer>
        </AdornerDecorator>
    </Grid>
</UserControl>
